pp108 : displayFormat Property

displayFormat Property


String that specifies a special format with which the value can be displayed.

Syntax

HTML

<ELEMENT id=elementID fieldType="sType" displayFormat=sFormat...>...</ELEMENT>

Scripting

elementID.displayFormat [ =sFormat ]

Parameters

Parameter

Description

sFormat

String that denotes the format with which the value can be displayed.locale- Data will be displayed according to system local settings. This is applicable for float and amount field types.

  • shortdate- Date displayed in short format specified in the local setting of the system. Recommended shortdate format is DD/MM/YYYY.
  • longdate- Date displayed in long format specified in the local setting of the system. Recommended longdate format is DDDD/MMMM/YYYY.

Remarks

The displayFormatproperty can be different for dates with formats other than the shortdate and longdate. The various possible formats that are supported are as follows :

date

D, DD, DDD and DDDD.

month

M, MM, MMM and MMMM.

year

YY and YYYY.

For the following display formats only, locale set in CUSP preferences are considered.

  1. shortdate
  2. shortdate shorttime
  3. longdate
  4. longdate longtime
  5. shorttime
  6. longtime


Unexpected results are expected when the date format is set with the year "YY". It is recommended to have the format as YYYY always. The date separator can be a dot (.), hyphen (-), or forward slash (/) .

Example

The following example shows how the displayFormatproperty can be used to set the format for various fields.

//validate definition inside the BODY
<div cordysType="wcp.library.util.Validate" id="validate" ></div>
//INPUT box with fieldType date
<input type="text" fieldType="date" displayFormat="DD-MM-YYYY">
//INPUT box with fieldType amount
<input type="text" fieldType="amount" displayFormat="locale">
//INPUT box with fieldType date
<input type="text" fieldType="date" displayFormat="longdate">

See Also


validate, calendar